package com.atguigu.tingshu;

import com.atguigu.tingshu.common.constant.RedisConstant;
import org.redisson.api.RBloomFilter;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;

@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
public class ServiceAlbumApplication implements CommandLineRunner {

    public static void main(String[] args) {
        SpringApplication.run(ServiceAlbumApplication.class, args);
    }


    @Autowired
    private RedissonClient redissonClient;

    /**
     * CommandLineRunner：启动项目后，执行run方法，且在启动项目后只执行一次以及在访问请求之前执行
     * @param args
     * @throws Exception
     */
    @Override
    public void run(String... args) throws Exception {
//        // 创建 bloomFilter ，且存储元素类型为 Long
//        RBloomFilter<Long> bloomFilter = redissonClient.getBloomFilter("Test:bloomfliter");
//        bloomFilter.tryInit(5000, 0.01);
//        System.out.println("bloomFilter 创建成功");


    }
}
